
/**
 * Created with IntelliJ IDEA.
 * Description:实现单例模式
 * Date: 2024-09-02
 * Time: 19:55
 */


public class Singleton {
    private static Singleton instance;

    private Singleton() {};

    public static Singleton getInstance() {
        if (instance == null) {
            synchronized (Singleton.class) {
                if (instance == null) {
                   instance = new Singleton();
                }
            }
        }

        return instance;
    }
}